-
-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scalapb-runtime-grpc: optimize Marshaller for InProcessTransport #1615
Conversation
* Allows skipping serialization completely when the io.grpc.inprocess.InProcessTransport is used. | ||
* Inspired by https://github.com/grpc/grpc-java/blob/master/protobuf-lite/src/main/java/io/grpc/protobuf/lite/ProtoInputStream.java | ||
*/ | ||
class ProtoInputStream[T <: GeneratedMessage](msg: T, val marshaller: Marshaller[T]) extends InputStream { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add unit tests for this class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in 6c26c6a
override def parse(inputStream: InputStream): T = | ||
companion.parseFrom(inputStream) | ||
override def parse(inputStream: InputStream): T = inputStream match { | ||
case pis: ProtoInputStream[T] if pis.marshaller == this => pis.message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the reason for comparing the marshallers? if not needed, the val marshaller
can be removed from the ProtoInputStream class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed in 8d8256c
introduced it to reproduce the following precaution logic, however seems to be redundant indeed.
project/Dependencies.scala
Outdated
@@ -60,6 +60,7 @@ object Dependencies { | |||
val grpcNetty = "io.grpc" % "grpc-netty" % versions.grpc | |||
val grpcServices = "io.grpc" % "grpc-services" % versions.grpc | |||
val grpcProtocGen = "io.grpc" % "protoc-gen-grpc-java" % versions.grpc | |||
val grpcInprocess = "io.grpc" % "grpc-inprocess" % versions.grpc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: align the whitespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, all tests are passing except formatting. Please run scalafmt within sbt and add to the PR as a new commit. |
resolves #1614